<?php
//Tieu diem
$sql = "SELECT id,title,introtext,images FROM #__content WHERE state=1 AND tieu_diem=1 ORDER BY ordering ASC, id DESC LIMIT 0,10";
$database->setQuery($sql);
$tieu_diem = $database->loadObjectList();
echo "<div class='list_box_right' style='margin-top:0;'>";
	echo "<div class='Title_Category'><span><a href='#'>Tiêu điểm</a></span></div>";
	for ($i=0; $i<count($tieu_diem); $i++){
		$link_td = "index.php?option=com_content&task=view&id=".$tieu_diem[$i]->id;
		if ($i%2==0){
			echo "<div style='clear:both; height:5px; border-top:1px solid #ccc; float:left; width:100%; margin-top:5px;'></div>";
		}
		echo "<div class='element'>";
			echo "<a href='".$link_td."'>";
			echo "<img src='".$mosConfig_live_site."/images/stories/".$tieu_diem[$i]->images."' border='0' />";
			echo $tieu_diem[$i]->title;
			echo "</a>";
		echo "</div>";
	}	
echo "</div>";
?>
<div id="video" style="margin-top:5px;">
<?php
$uploaddir = $mosConfig_live_site."/administrator/components/com_video/uploads/";
$option = mosGetParam($_REQUEST, 'option', '');
$id = intval(mosGetParam($_REQUEST, 'id', 0));
if ($option=='com_video' && $id!=0){
	$sql = "SELECT * FROM #__video WHERE id=".$id;
	$database->setQuery($sql);
	$database->loadObject($selectVideo);
	?>
	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="480" height="350"><param name="flashvars" value="file=<?php echo $uploaddir.$selectVideo->video;?>&image=<?php echo $uploaddir.$selectVideo->img;?>" /><param name="movie" value="<?php echo $mosConfig_live_site;?>/images/mediaplayer.swf" /><embed src="<?php echo $mosConfig_live_site;?>/images/mediaplayer.swf" width="480" height="350" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="file=<?php echo $uploaddir.$selectVideo->video;?>&image=<?php echo $uploaddir.$selectVideo->img;?>" />
	</object>
	<?php
}
else{
	$sql = "SELECT * FROM #__video WHERE status=1 ORDER BY ordering ASC, id DESC LIMIT 0,1";
	$database->setQuery($sql);
	$database->loadObject($newVideo);
	?>
	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="480" height="350"><param name="flashvars" value="file=<?php echo $uploaddir.$newVideo->video;?>&image=<?php echo $uploaddir.$newVideo->img;?>" /><param name="movie" value="<?php echo $mosConfig_live_site;?>/images/mediaplayer.swf" /><embed src="<?php echo $mosConfig_live_site;?>/images/mediaplayer.swf" width="480" height="350" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="file=<?php echo $uploaddir.$newVideo->video;?>&image=<?php echo $uploaddir.$newVideo->img;?>" />
	</object>	
	<?php
}
?>
</div>
<div class="list_box_right">
	<div class="Title_Category"><span><a href="index.php?option=com_content&task=blogcategory&id=25&Itemid=38">Các lợi ích Đại siêu thị di động mang đến cho bạn</a></span></div>
	<?php
	//Loi ich tu mobimart
	$sql = "SELECT id,title,created FROM #__content WHERE state=1 AND catid=25 ORDER BY ordering ASC, id DESC LIMIT 0,15";
	$database->setQuery($sql);
	$list_loi_ich = $database->loadObjectList();
	?>
	<ul>
		<?php 
		for ($i=0; $i<count($list_loi_ich); $i++){
		$link_loi_ich = "index.php?option=com_content&task=view&id=".$list_loi_ich[$i]->id;
			if ($i==count($list_loi_ich)-1){
				echo "<li style='border:0;'><span><a href=".$link_loi_ich.">".$list_loi_ich[$i]->title."</a></span><span class='namemember'>Ngày đăng: ".unFormatDate($list_loi_ich[$i]->created,"d/m/Y")."</span></li>";
			}
			else{
				echo "<li><span><a href='".$link_loi_ich."'>".$list_loi_ich[$i]->title."</a></span><span class='namemember'>Ngày đăng: ".unFormatDate($list_loi_ich[$i]->created,"d/m/Y")."</span></li>";
			}
		 }?>										
	</ul>
</div>
<!--<div class="advertising">Dành cho quảng cáo</div>-->
<div class="list_box_small" style="width:100%;">
<?php
//Bao hanh
$sql = "SELECT id,title FROM #__categories WHERE published=1 AND id in(26,27,28) ORDER BY ordering ASC, id DESC";
$database->setQuery($sql);
$bao_hanh = $database->loadObjectList();
for ($i=0; $i<count($bao_hanh); $i++){
	if ($bao_hanh[$i]->id==28){
		$Itemid = 39;		
	}
	else if ($bao_hanh[$i]->id==27){
		$Itemid = 40;
	}
	else if ($bao_hanh[$i]->id==26){
		$Itemid = 41;
	}
	$link_bao_hanh = "index.php?option=com_content&task=blogcategory&id=".$bao_hanh[$i]->id."&Itemid=".$Itemid;	
	$sql = "SELECT id,title,images FROM #__content WHERE state=1 AND catid=".$bao_hanh[$i]->id." ORDER BY ordering ASC, id DESC LIMIT 0,5";
	$database->setQuery($sql);
	$field_bao_hanh = $database->loadObjectList();
?>
	<div class="Title_Category"><span><a href="<?php echo $link_bao_hanh;?>"><?php echo $bao_hanh[$i]->title;?></a></span></div>
	<?php
	for ($j=0; $j<count($field_bao_hanh); $j++){
		$link_field_bao_hanh = "index.php?option=com_content&task=view&id=".$field_bao_hanh[$j]->id;
		echo "<div class='box_rows'>";
			echo "<div class='element_small'>";
				echo "<img src='".$mosConfig_live_site."/images/stories/".$field_bao_hanh[$j]->images."' width='70' height='60' border='0' />";
				echo "<a href='".$link_field_bao_hanh."'>".$field_bao_hanh[$j]->title."</a>";
			echo "</div>";
		echo "</div>";
		}					
	}?>	
</div>
<?php
echo'<div class="list_box_small" style="width:100%;">';
	echo '<div class="Title_Category"><span>Thống kê truy cập</span></div>';
	mosLoadModules ( 'user6', -1);
echo'</div>';
?>